home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1826 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: gryphon.phoenix.net!usenet
  2. From: brucew@phoenix.net (Bruce Wedding)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Linker ERROR: BC4 --  HELP!!!
  5. Date: Wed, 17 Jan 1996 05:20:30 GMT
  6. Organization: BranPaul Systems
  7. Message-ID: <4dhul3$3fb@gryphon.phoenix.net>
  8. References: <4denut$2k9@lastactionhero.rs.itd.umich.edu>
  9. NNTP-Posting-Host: dial110.phoenix.net
  10. X-Newsreader: Moe's Newsreader    
  11.  
  12. mschunde@umich.edu (Mark Schunder) wrote:
  13.  
  14. >Linker Error: _uiKey defined in module KEYBOARD.C is duplicated in
  15. >module MAIN.C
  16.  
  17. >KeybTaskHandle and uiKey are suppose to be global varaibles.  uiKey is
  18. >accessed by two different c files : Keyboard.c (this file updates
  19. >uiKey with the ascii when the user presses a key on the keyboard) and
  20. >main.c (this file monitors uiKey, when it changes, it repaints the
  21. >screen according to the value of uiKey).
  22. >
  23. >I do not know why I'm getting these errors.  I have the keyboard.c
  24. >header file included in both KEYBOARD.c and MAIN.C (so both sets of
  25. >files can see the variable and read and update the variables
  26. >accordingly).  
  27.  
  28. It sounds like you have defined the global in a header file.  That is
  29. poor style.  Define the global in one module, preferably global.c if
  30. this is a large project,  and then declare it extern in the header
  31. file that is included with every other module that used it.
  32.  
  33. Bruce D. Wedding                        Have Compiler, Will Travel!
  34.               Perspicacious Programming Performed Promptly
  35. Katy, Texas, USA, Planet Earth, Milkyway Galaxy, Known Universe
  36.  
  37.